package org.wishwork.api.auth;

import org.wishwork.api.auth.get.AuthUrl;
import org.wishwork.context.Context;

import java.io.IOException;

/**
 * @description: 授权Api  通过接口获取聚水潭的数据，需要店铺先授权
 * @author: WangYX
 * @create: 2022-04-01 17:03
 * @Version: 1.0.0
 **/

public class AuthUrlApi {

    private Context context;

    private final AuthUrl authUrl;

    public AuthUrlApi(Context context) {
        this.context = context;
        this.authUrl = new AuthUrl(context);
    }

    /**
     * 获取授权的URL
     *
     * @param state 自定义参数，在授权回调的时候会默认传过来
     * @return
     * @throws IOException
     */
    public String authUrl(String state) throws Exception {
        return authUrl.getAuthUrl(state);
    }

    /**
     * 获取授权的URL
     *
     * @return
     * @throws IOException
     */
    public String authUrl() throws Exception {
        return authUrl.getAuthUrl(null);
    }

}
